@extends('admin.public.admin')
@section('main')
<!-- 内容 -->
<div class="mws-panel grid_8">

		<div class="mws-panel-header">
			<span><i class="icon-table"></i> 管理员列表</span>
		</div>

        <div class="mws-panel-body no-padding">
            	<div id="DataTables_Table_1_wrapper" class="dataTables_wrapper" role="grid">

               <form method="get" action="/admin/orders">

            		  <div id="DataTables_Table_1_length" class="dataTables_length">
               
              			<label>显示 
  	                        <select size="1" name="count" aria-controls="DataTables_Table_1">
  		                        <option value="10" @if(!empty($request['count']) && $request['count'] == 10) selected @endif>10</option>
          				        		<option value="20" @if(!empty($request['count']) && $request['count'] == 20) selected @endif>20</option>
          				        		<option value="30" @if(!empty($request['count']) && $request['count'] == 30) selected @endif>30</option>
          				        		<option value="50" @if(!empty($request['count']) && $request['count'] == 50) selected @endif>50</option>
  	                        </select> 
              			条
              			</label>
            		  </div>

            <div class="dataTables_filter" id="DataTables_Table_1_filter">
                    <label>
                    	搜索: <input type="text" name="search" value="{{$request['search'] or ''}}" aria-controls="DataTables_Table_1">
                            <input type="submit" class="btn btn-success btn-xs" value="搜索">
                    </label>
            </div>
            </form>
            <table class="mws-datatable-fn mws-table dataTable" id="DataTables_Table_1" aria-describedby="DataTables_Table_1_info">
                <thead>
                    <tr role="row">
		                    <th>订单号</th>
                        <th>用户</th>
                        <th>收货人信息</th>
                        <th>订单状态</th>
                        <th>下单时间</th>
                        <th>操作</th>
                    </tr>
                </thead>
               
            <tbody role="alert" aria-live="polite" aria-relevant="all">
            @foreach($data as $k=>$v)
              
                <tr>
                      <td><a href="/admin/orders/list?code={{$v['code']}}" class="btn btn-primary">{{$v['code']}}</a></td>
                      
                      <td>{{$v['nickname']}}</td>

                      <td>
                        <!-- <a href="/admin/orders/addr?id={{$v['aid']}}" class="btn btn-success">收货人信息</a> -->
                        <a href="javascript:;" onclick="show({{$v['aid']}})" data-toggle="modal" data-target="#show" class="btn btn-success">收货人信息</a>
                      </td>

                      <td>{{$v['ssname']}}</td>

                      <td>{{date("Y-m-d H:i:s",$v['time'])}}</td>


                     <td>
                         @if($v['sid']==6)
                            <a href="javascript:;" style="cursor:allowed" class="btn btn-warning">已完成</a>
                               @else
                            <a href="/admin/orders/edit?sid={{$v['sid']}}&code={{$v['code']}}" class="btn btn-danger">修改状态</a>
                          @endif
          
                      </td>
                    </tr>

              @endforeach
             </tbody>
           </table>

           <!-- 分页 -->
              <div id="page_page">
                  {!! $data->appends($request)->render()!!}
              </div>
           </div>
      </div>
</div>

<!-- 添加页面模态框 -->
<div class="modal fade" id="show">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
        <h4 class="modal-title">收货人信息</h4>
      </div>
      <div class="modal-body" id="aaaa">
        
      </div>
      
    </div><!-- /.modal-content -->
  </div><!-- /.modal-dialog -->
</div><!-- /.modal -->



  <script type="text/javascript">
//属性展示页面

  function show(id){

    // 发送ajax请求
    $.get("/admin/orders/addr/"+id,{},function(data){

      if (data) {

        $("#aaaa").html(data);
      };

    });


  }
</script>
	@endsection